import { productList, lubboList, floorList } from '@/api'

// home 模块的小仓库
const state = {
    caryListdata: [],
    getbannerListdata: [],
    floorListData:[]
}
const mutations = {
    // 三级联动
    caryListdata(state, rel) {
        state.caryListdata = rel
    },
    // 轮播图
    getbannerListdata(state, rel) {
        state.getbannerListdata = rel
    },
    floorListData(state, rel){
        state.floorListData = rel
    }
}
const actions = {
    // 三级联动
    async caryList({ commit }) {
        let result = await productList()
        if (result.code == 200) {
            commit('caryListdata', result.data)
        }
    },
    // 轮播图
    async getbannerList({ commit }) {
        let result = await lubboList()
        if (result.code == 200) {
            commit('getbannerListdata', result.data)
        }
    },
    // floor数据
    async getfloorList({ commit }) {
        let result = await floorList()
        if (result.code == 200) {
            commit('floorListData', result.data)
        }
    }

}
const getters = {}
export default {
    state,
    mutations,
    actions,
    getters
}